package com.hhu.wangzb.shiro.util;

import com.hhu.wangzb.common.exception.CustomException;
import org.apache.shiro.SecurityUtils;

public class AuthorizationUtils {

    public static void hasPermission(String perm) {
        if (!SecurityUtils.getSubject().isPermitted(perm)) throw new CustomException("权限不足");
    }

    public static void hasAllPermissions(String... perms) {
        if (!SecurityUtils.getSubject().isPermittedAll(perms)) throw new CustomException("权限不足");
    }

}
